package model
{
	import flash3.framework.MapManager;
	import flash3.framework.Singleton;
	
	import vo.ErrorInfo;

	public class ErrorInfoModel extends MapManager
	{
		public static const ERROR_CONNECTCLOSE:uint = 0;
		public static const ERROR_IOERROR:uint = 1;
		public static const ERROR_SECURITYERROR:uint = 2;
		public static const ERROR_LOGIN_FAILED:uint = 3;
		
		public function ErrorInfoModel()
		{
			super();
			register(ERROR_CONNECTCLOSE, "您与服务器的链接出现故障，请重刷新页面！");
			register(ERROR_IOERROR, "IO错误，请稍后再试！");
			register(ERROR_SECURITYERROR, "安全错误，请稍后再试！");
			register(ERROR_LOGIN_FAILED, "登陆失败，请检查用户名和密码！");
		}
		
		static public function get i():ErrorInfoModel
		{
			return Singleton.getInstanceOrCreate(ErrorInfoModel) as ErrorInfoModel;
		}
		
		public function register(code:int, describe:String):void
		{
			var errorInfo:ErrorInfo = new ErrorInfo();
			errorInfo.code = code;
			errorInfo.describe = describe;
			this.add(code, errorInfo);
		}
	}
}